Syndynes plots and fixes#434
Conversation
|
Thank you for your contribution to sbpy, an Astropy affiliated package! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
|
Keeping this a draft until #427 is done. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #434 +/- ##
==========================================
+ Coverage 81.81% 82.09% +0.28%
==========================================
Files 53 53
Lines 4267 4335 +68
==========================================
+ Hits 3491 3559 +68
Misses 776 776 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Updated comment with API-breaking change in to_ephem. |
4786e0c to
8327d22
Compare
|
I didn't see any notable issues in the code changes and the functionality seems good after the various API and other changes to the previous way of doing things. My main comments are on the documentation:
|
Yeah, I see what you are saying. I'll move the orbit section to be contiguous with the syndyne and synchrone sections, and add some words before all this to clarify what is happening here: the
I think the above edits should help explain why this doesn't work. |
fixed |
That makes sense. Moved!
Instead of repeating everything, I have enable the full "source code" link for the figure. Is that OK? |
* Move to_ephem to StateBase * compute coordinates if an observer is given * put frame in Ephem metadata
to_ephem: * Remove coords column from to_ephem due to problem vstacking SkyCoords columns when frame contains obstime * Use StateBase's to_ephem for most of the work. plot() * Fix cosine correction * Allow spherical coords other than RA/Dec Fix SourceOrbit.epoch SynCollection: * __getitem__ should return SynCollections for tuples and slices * Use Ephem's vstack in to_ephem
Replace random_syn* with fake_syn*
The t is observation time.
89e09dc to
ccc5ebd
Compare
And, done. |
|
@hhsieh00 ready for your reconsideration |
hhsieh00
left a comment
There was a problem hiding this comment.
Finally went through all the changes and new documentation text. Looks good now!
Summary
plot()methods to syndyne and synchrone classesSourceOrbitclass to encapsulate a collection of states that make up an orbit.SynGenerator.source_orbitto use the newSourceOrbitclass.Stateobjects from Horizons viaEphem.from_horizons.Ephem.from_horizonsis populated with masked quantities, butWCScan crash trying to convert masked coordinates to pixels. Added a newsbpy.utils._unmaskedfunction which will return an unmasked object using an astropy 7.0 function (or fall back on an internal method for astropy < 7).State.to_ephemwas in the documentation, but not the code! Added this function..plot()methodsSyndyne and synchrone plotting is simplified. Previously one might have written:
Now, much of that is incorporated into sbpy:
See the documentation for more examples.
API changes with
SourceOrbitSynGenerator.source_orbitreturned a tuple including the states and coordinates of the orbit at the requested times. But these can be collected into a single object, just likeSyndyneandSynchroneinclude their own particle states and coordinates. Furthermore, it would be great to use the newplot()approach thatSyndyneandSynchroneuse. To that end, I've created the newSourceOrbitclass.Previously:
Now with
SourceOrbitthe same machinery behindSyndynesandSynchronescan be used:API changes with
SyndynesandSynchronesIndexing with int, slice, or tuple
Indexing
SyndynesorSynchroneswould return singleSyndyne/Synchroneobjects, or a list thereof:This behavior was OK, but with the new
.plot()methods, returning a list drops the fancy machinery behind, e.g.,Synchrones.plot(). As a result we would have to use the individual plot methods, which also means the label needs to be specified to achieve the same behavior:Now indexing with a slice (or tuple) will return a
SyndynesorSynchronesobject, and we can immediately plot the results:Drop "coords" from
to_ephem()resultThe heliocentric ecliptic IAU76 reference frame needs observation time. When creating an
Ephemobject fromSynchronesin that frame, the coordinates of each synchrone could not be concatenated. I think it is because the observation times in the reference frame did not match, so astropy thought the reference frames were different, and in a way that is right. Rather than hack something here, just drop the coords column. RA, Dec, etc. are already included as separate columns, so there is no loss of information.